package com.hm.hsw1;

public class Student {
    private String name;
    private char sex;
    private int age;

    public Student(String name, char sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public Student() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        if(sex=='男'||sex=='女'){
            this.sex = sex;
        }else{
            throw new SexException("GENDER_INPUT_IS_INCORRECT");
        }
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age>=15&&age<=50){
            this.age = age;
        }else{
            throw new AgeException("AGE_INPUT_IS_INCORRECT");
        }
    }
}
